<template>
    <div class="app-container">
        <el-tabs v-model="currentTab" type="card" class="center-tabs" @tab-click="tabHandleClick">
            <el-tab-pane label="基本信息" name="baseInfo">
                <el-row class="base-info-box " v-if="baseInfoData.length > 0">
                    <span>姓名:{{ baseInfoData[0].patientName }}</span>
                    <span>性别: <dict-tag :options="dict.type.sys_user_sex" :value="baseInfoData[0].sex"
                            style="display: inline-block;" /></span>
                    <span>出生日期:{{ baseInfoData[0].birthDate }}</span>
                    <span> 身份证:{{ baseInfoData[0].idNum }}</span>
                </el-row>
                <el-collapse v-model="activeName" accordion>
                    <el-collapse-item
                        :title="'顾客编号：' + item.visitNum + '登记日期：' + parseTime(item.createTime) + '诊断状态：' + getDiagnosisStatusLabel(item.status)"
                        v-for="(item, index) in baseInfoData" :key="index" :name="index">
                        <el-form :model="baseInfoForm" ref="baseInfoForm" size="small" :inline="true" label-width="68px"
                            label-position="left">
                            <el-form-item label="顾客编号" prop="visitNum">
                                <el-input v-model="item.visitNum" clearable style="width: 160px" />
                            </el-form-item>
                            <el-form-item label="顾客性质" prop="properties">
                                <el-select v-model="item.properties" placeholder="请选择顾客性质" clearable style="width: 160px">
                                    <el-option v-for="dict in dict.type.sys_patient_properties" :key="dict.value"
                                        :label="dict.label" :value="dict.value" />
                                </el-select>
                            </el-form-item>
                            <el-form-item label="顾客分类" prop="customerSort">
                                <el-select v-model="item.customerSort" placeholder="请选择顾客分类" clearable style="width: 160px">
                                    <el-option v-for="dict in dict.type.sys_patient_sort" :key="dict.value"
                                        :label="dict.label" :value="dict.value" />
                                </el-select>
                            </el-form-item>
                            <el-form-item label="皮肤色度" prop="tone">
                                <el-select v-model="item.tone" placeholder="请选择皮肤色度" clearable style="width: 160px">
                                    <el-option v-for="dict in dict.type.sys_skin_tone" :key="dict.value" :label="dict.label"
                                        :value="dict.value" />
                                </el-select>
                            </el-form-item>
                            <el-form-item label="状态" prop="status">
                                <el-select v-model="item.status" clearable style="width: 160px">
                                    <el-option v-for="dict in dict.type.sys_diagnosis_status" :key="dict.value"
                                        :label="dict.label" :value="dict.value" />
                                </el-select>
                            </el-form-item>
                            <el-form-item label="手机" prop="patientPhone">
                                <el-input v-model="item.patientPhone" clearable style="width: 160px" />
                            </el-form-item>
                            <el-form-item label="职业" prop="job">
                                <el-input v-model="item.job" clearable style="width: 160px" />
                            </el-form-item>
                            <el-form-item label="微信号" prop="wxNum">
                                <el-input v-model="item.wxNum" clearable style="width: 160px" />
                            </el-form-item>
                            <el-form-item label="卡号" prop="cardNumber">
                                <el-input v-model="item.cardNumber" clearable style="width: 160px" />
                            </el-form-item>
                            <el-form-item label="登记人" prop="createBy">
                                <el-input v-model="item.createBy" clearable style="width: 160px" />
                            </el-form-item>
                            <el-form-item label="患者地址" prop="area">
                                <el-cascader v-model="item.area" placeholder="省,市,区" class="picker-form" :options="areaList"
                                    :props="{ children: 'childrenList', value: 'id', label: 'name' }" style="width: 400px">
                                </el-cascader>
                            </el-form-item>
                            <el-form-item label="详细地址" prop="address">
                                <el-input v-model="item.address" clearable style="width: 400px" />
                            </el-form-item>
                            <el-form-item label="备注" prop="remark">
                                <el-input v-model="item.remark" type="textarea" style="width: 400px" clearable />
                            </el-form-item>
                        </el-form>
                    </el-collapse-item>
                </el-collapse>
            </el-tab-pane>
            <el-tab-pane label="诊前问卷" name="PrediagnosisQuestionnaire">
                <div style="display: flex;overflow-x: auto;margin-bottom: 20px;">
                    <el-button size="medium" @click="openQuestionnaire(item, index)"
                        v-for="(item, index) in prediagnosisQuestionnaireDataList" :key="index"
                        :class="isActive == index ? 'yesActive' : ''">{{
                            parseTime(item.writeTime) + item.formName }}</el-button>
                </div>
                <div>
                    <formpreview v-if="formpreviewContList != null" :formPreviewList="formpreviewContList"
                        :questionFormInfo="questionFormInfo" />
                </div>
                <!-- <el-table :data="prediagnosisQuestionnaireDataList">
                    <el-table-column label="顾客编号" align="center" prop="visitNum" />
                    <el-table-column label="顾客姓名" align="center" prop="patientName" :show-overflow-tooltip="true" />
                    <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" width="120px">
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_diagnosis_status" :value="scope.row.status" />
                        </template>
                    </el-table-column>
                    <el-table-column label="问卷名称" align="center" prop="formName" />
                    <el-table-column label="填写设备" align="center" prop="equipment" />
                    <el-table-column label="填写时间" align="center" prop="writeTime">
                        <template slot-scope="scope">
                            <span>{{ parseTime(scope.row.writeTime) }}</span>
                        </template></el-table-column>
                    <el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width"
                        width="180">
                        <template slot-scope="scope">
                            <el-button size="mini" type="text" icon="el-icon-document"
                                @click="openQuestionnaire(scope.row)">查看</el-button>
                        </template>
                    </el-table-column>
                </el-table> -->
            </el-tab-pane>
            <el-tab-pane label="照片" name="pictures">
                <el-row>
                    <el-form :model="pictureForm" ref="pictureForm" size="small" :inline="true" label-width="78px">
                        <el-form-item label="拍照设备" prop="type">
                            <el-select v-model="pictureForm.type" placeholder="请选择拍照设备" style="width: 120px" clearable>
                                <el-option v-for="dict in dict.type.photo_upload_type" :key="dict.value" :label="dict.label"
                                    :value="dict.value"></el-option>
                            </el-select>
                        </el-form-item>
                        <!-- <el-form-item label="光照类型" prop="photoLightingType">
                            <el-select v-model="pictureForm.photoLightingType" placeholder="请选择光照类型" style="width: 120px">
                                <el-option v-for="dict in dict.type.photo_lighting_type" :key="dict.value"
                                    :label="dict.label" :value="dict.value"></el-option>
                            </el-select>
                        </el-form-item> -->
                        <!-- <el-form-item label="采集时刻" prop="status">
                                <el-select v-model="pictureForm.status" placeholder="采集时刻" clearable style="width: 120px">
                                    <el-option v-for="dict in dict.type.sys_diagnosis_status" :key="dict.value"
                                        :label="dict.label" :value="dict.value" />
                                </el-select>
                            </el-form-item> -->
                        <!-- <el-form-item label="顾客编号" prop="visitNum">
                            <el-input v-model="pictureForm.visitNum" placeholder="请输入顾客编号" clearable style="width: 135px" />
                        </el-form-item> -->
                        <el-form-item label="采集日期">
                            <el-date-picker v-model="dateRange" style="width: 240px" value-format="yyyy-MM-dd"
                                type="daterange" range-separator="-" start-placeholder="开始日期"
                                end-placeholder="结束日期"></el-date-picker>
                        </el-form-item>
                        <el-button type="primary" size="mini" @click="search">查询</el-button>
                        <el-button type="primary" size="mini" @click="comparePics">对比显示该顾客照片</el-button>
                    </el-form>
                </el-row>
                <el-row v-for="(item, index) in picData" :key="index" style="margin-top:15px;">
                    <el-col :span="24" class="group-info">
                        <span> 采集日期:{{ item.sysPatientPhotos[0].createTime }}</span>
                        <!-- <span>采集时刻:咨询前</span> -->
                        <span class="device">设备:<dict-tag :options="dict.type.photo_upload_type"
                                :value="item.sysPatientPhotos[0].type" /></span>
                        <span>上传人:{{
                            item.sysPatientPhotos[0].createBy }}</span>
                        <span> Ai mMASI:5分</span>
                    </el-col>
                    <el-col :span="24" style="display:flex;flex-wrap: wrap;">
                        <div class="img-txt" v-for="it in item.sysPatientPhotos">
                            <!--                                <el-image style="width: 198px; height: 315px" :src="baseUrl + it.photoAddress"-->
                            <!--                                    :preview-src-list="srcList" @click="getPicPreviewList(item)">-->
                            <!--                                </el-image>-->
                            <el-image style="width: 260px; height: 412px" :src="baseUrl + it.thumbnail"
                                :preview-src-list="srcList" @click="getPicPreviewList(item)">
                            </el-image>
                            <span>
                                <dict-tag :options="dict.type.photo_lighting_type" :value="it.faceLight" />
                                <dict-tag :options="dict.type.sys_face_part" :value="it.facePart" />
                            </span>
                        </div>
                    </el-col>
                </el-row>
            </el-tab-pane>
            <el-tab-pane label="知情同意书" name="consent">
                <div style="display: flex;overflow-x: auto;">
                    <el-button size="mini" type="primary" @click="handleconsentDialog(item)" v-for="item in consentDataList"
                        :key="item.id">{{
                            parseTime(item.signTime) + item.consentName }}</el-button>
                </div>
                <div style="width: 600px;margin: 0 auto;">
                    <!-- <el-image :src="zqtysImg" :preview-src-list="srcList">
                    </el-image> -->
                </div>
                <!-- <el-table :data="consentDataList">
                    <el-table-column label="序号" align="center" prop="index" />
                    <el-table-column label="顾客编号" align="center" prop="id" />
                    <el-table-column label="顾客姓名" align="center" prop="name" :show-overflow-tooltip="true" />
                    <el-table-column label="登记日期" align="center" prop="registrationDate" width="180"></el-table-column>
                    <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" width="120px">
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_diagnosis_status" :value="scope.row.status" />
                        </template>
                    </el-table-column>
                    <el-table-column label="诊断" align="center" prop="diagnosis" />
                    <el-table-column label="知情同意书名称" align="center" prop="consentName" />
                    <el-table-column label="签署状态" align="center" prop="signStatus" />
                    <el-table-column label="签署时间" align="center" prop="signTime" />
                    <el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width"
                        width="180">
                        <template slot-scope="scope">
                            <el-button size="mini" type="text" icon="el-icon-document"
                                @click="handleconsentDialog(scope.row)">查看</el-button>
                        </template>
                    </el-table-column>
                </el-table> -->
            </el-tab-pane>
            <el-tab-pane label="随访" name="followupVisitDataList">
                <div style="display: flex;overflow-x: auto;">
                    <el-button size="mini" type="primary" @click="openFollowupVisit(item)"
                        v-for="item in followupVisitDataList" :key="item.id">{{
                            parseTime(item.followupTime) + item.name }}</el-button>
                </div>
                <div>
                    <formpreview v-if="formpreviewContList != null" :formPreviewList="formpreviewContList"
                        :questionFormInfo="questionFormInfo" />
                </div>
                <!-- <el-table :data="followupVisitDataList">
                    <el-table-column label="序号" align="center" prop="index" />
                    <el-table-column label="顾客编号" align="center" prop="id" />
                    <el-table-column label="顾客姓名" align="center" prop="name" :show-overflow-tooltip="true" />
                    <el-table-column label="登记日期" align="center" prop="registrationDate" width="180"></el-table-column>
                    <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" width="120px">
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_diagnosis_status" :value="scope.row.status" />
                        </template>
                    </el-table-column>
                    <el-table-column label="诊断" align="center" prop="diagnosis" />
                    <el-table-column label="咨询医生" align="center" prop="consultants" />
                    <el-table-column label="开单医生" align="center" prop="doctorName" />
                    <el-table-column label="随访时间" align="center" prop="followupTime" />
                    <el-table-column label="形式" align="center" prop="followupForm" />
                    <el-table-column label="随访时刻" align="center" prop="followupMoment" />
                    <el-table-column label="随访人" align="center" prop="followupPeople" />
                    <el-table-column label="随访记录" align="center" prop="followupRecords" />
                </el-table> -->
            </el-tab-pane>
            <el-tab-pane label="诊断和方案" name="diagnosisAndProject">
                <el-table :data="diagnosisAndProjectDataList">
                    <el-table-column label="序号" align="center" prop="index" />
                    <el-table-column label="顾客编号" align="center" prop="id" />
                    <el-table-column label="顾客姓名" align="center" prop="name" :show-overflow-tooltip="true" />
                    <el-table-column label="方案日期" align="center" prop="programDate" width="180"></el-table-column>
                    <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" width="120px">
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_diagnosis_status" :value="scope.row.status" />
                        </template>
                    </el-table-column>
                    <el-table-column label="诊断" align="center" prop="diagnosis" />
                    <el-table-column label="咨询医生" align="center" prop="consultants" />
                    <el-table-column label="开单医生" align="center" prop="doctorName" />
                    <el-table-column label="治疗项目" align="center" prop="treatmentProgram" />
                    <el-table-column label="备注" align="center" prop="remark" />
                </el-table>
            </el-tab-pane>
            <el-tab-pane label="治疗记录" name="treatmentRecord">
                <el-row class="treatment-tips">
                    <!-- <span>激光10次余3次</span> <span>皮秒10次余1次</span> -->
                </el-row>
                <el-table :data="treatmentRecordDataList">
                    <el-table-column label="序号" align="center" prop="index" />
                    <el-table-column label="顾客编号" align="center" prop="id" />
                    <el-table-column label="顾客姓名" align="center" prop="name" :show-overflow-tooltip="true" />
                    <el-table-column label="登记日期" align="center" prop="registrationDate" width="180"></el-table-column>
                    <el-table-column label="诊断" align="center" prop="diagnosis" />
                    <el-table-column label="接诊人" align="center" prop="doctorName" />
                    <el-table-column label="敷药" align="center" prop="fuyao" />
                    <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" width="120px">
                        <template slot-scope="scope">
                            <dict-tag :options="dict.type.sys_diagnosis_status" :value="scope.row.status" />
                        </template>
                    </el-table-column>
                    <el-table-column label="治疗项目" align="center" prop="treatmentProgram" />
                    <el-table-column label="治疗次数" align="center" prop="numberOfTreatments" />
                    <el-table-column label="治疗时年龄" align="center" prop="treatmentAge" />
                    <el-table-column label="治疗反应" align="center" prop="treatmentResponse" />
                    <el-table-column label="治疗效果" align="center" prop="treatmentResult" />
                    <el-table-column label="治疗日期" align="center" prop="treatmentDate" width="180" />
                    <el-table-column label="治疗价格" align="center" prop="treatmentPrice" />
                    <el-table-column label="备注" align="center" prop="remark" />
                </el-table>
            </el-tab-pane>
        </el-tabs>
        <el-dialog title="照片比对" :visible.sync="comparePicsDialogVisible" width="85%" center :close-on-click-modal="false"
            v-dialogDrag>
            <comparePics :patientId="patientItem.patientId" v-if="!!patientItem.patientId"></comparePics>
        </el-dialog>
    </div>
</template>

<script>
import { getVisit } from "@/api/patientRegistration/registrationList"

import { addressJson, listPhoto } from "@/api/patients/personal";
import { listPhotos } from "@/api/patients/patient";
import Formpreview from "@/views/system/form/Formpreview";
import comparePics from "@/views/photoWorkstation/photoList/comparePics";
import { listFormCont, listCustomerForm, updateAnswer } from "@/api/system/form";
export default {
    name: "customerDetails",
    components: {
        Formpreview,
        comparePics
    },
    dicts: ['sys_diagnosis_status', 'sys_user_sex', "photo_upload_type", "photo_lighting_type", "sys_face_part", "sys_patient_properties", "sys_skin_tone", "sys_patient_sort",],
    props: {
        currentTab: {
            type: String,
            default: 'baseInfo'
        },
    },
    data() {
        return {
            baseUrl: process.env.VUE_APP_BASE_API,
            // currentTab: 'baseInfo',
            isActive: '0',
            // 省市区
            areaList: [],
            baseInfoForm: {
                id: 1,
                name: '王晓',
                sex: 0,
                age: 23,
                phoneNumber: '',
                IDnumber: '111001199010123210',
                wechat: '',
                wechatName: '',
                patientAddress: '',
                detailedAddress: '',
                visitDepartment: '皮肤科',
                status: 0,
                cardNumber: '121001',
                xingZhi: '临床',
                customerClassification: 'vip',
                diagnosis: '诊断内容',
                PrediagnosisQuestionnaire: '未填写',
                pictures: 0,
                registerPerson: '登记护士',
                registrationDate: '2022-09-05 10:29:39',
                consultants: '咨询护士',
                consultationDate: '2022-09-05 11:39:19',
                doctorName: '诊断医生',
                firstVisitDate: '2022-09-05 15:36:49',
                consent: '是否接受咨询',
                treatmentPrograms: '别熬夜',
                numberOfTreatments: '3/10',
                remark: '备注内容',
                date: '',
            },
            baseInfoData: [],
            // 拍摄照片表单
            pictureForm: {
                photoLightingType: '',
                type: '',
                visitNum: '',
                patientId: ''
            },

            dataList: [
                {
                    id: 1,
                    name: '王晓',
                    sex: 0,
                    age: 23,
                    phoneNumber: '',
                    IDnumber: '111001199010123210',
                    wechat: '',
                    wechatName: '',
                    patientAddress: '',
                    detailedAddress: '',
                    visitDepartment: '皮肤科',
                    status: 0,
                    cardNumber: '121001',
                    xingZhi: '临床',
                    customerClassification: 'vip',
                    diagnosis: '诊断内容',
                    PrediagnosisQuestionnaire: '未填写',
                    pictures: 0,
                    registerPerson: '登记护士',
                    registrationDate: '2022-09-05 10:29:39',
                    consultants: '咨询护士',
                    consultationDate: '2022-09-05 11:39:19',
                    doctorName: '诊断医生',
                    firstVisitDate: '2022-09-05 15:36:49',
                    consent: '是否接受咨询',
                    treatmentPrograms: '别熬夜',
                    numberOfTreatments: '3/10',
                    remark: '备注内容',
                    date: '',
                },
                {
                    id: 1,
                    name: '王晓',
                    sex: 0,
                    age: 23,
                    phoneNumber: '',
                    IDnumber: '111001199010123210',
                    wechat: '',
                    wechatName: '',
                    patientAddress: '',
                    detailedAddress: '',
                    visitDepartment: '皮肤科',
                    status: 0,
                    cardNumber: '121001',
                    xingZhi: '临床',
                    customerClassification: 'vip',
                    diagnosis: '诊断内容',
                    PrediagnosisQuestionnaire: '未填写',
                    pictures: 0,
                    registerPerson: '登记护士',
                    registrationDate: '2022-09-05 10:29:39',
                    consultants: '咨询护士',
                    consultationDate: '2022-09-05 11:39:19',
                    doctorName: '诊断医生',
                    firstVisitDate: '2022-09-05 15:36:49',
                    consent: '是否接受咨询',
                    treatmentPrograms: '别熬夜',
                    numberOfTreatments: '3/10',
                    remark: '备注内容',
                    date: '',
                },
            ],
            prediagnosisQuestionnaireDataList: [],
            consentDataList: [
                // {
                //     index: 1,
                //     id: 1,
                //     name: '王晓',
                //     registrationDate: '2022-09-05 10:29:39',
                //     status: 0,
                //     diagnosis: '诊断内容',
                //     consentName: '知情同意书名称',
                //     signStatus: '已签署',
                //     signTime: '2022-09-05 10:29:39',
                // }
            ],
            followupVisitDataList: [
                // {
                //     index: 1,
                //     id: 1,
                //     name: '王晓',
                //     registrationDate: '2022-09-05 10:29:39',
                //     status: 0,
                //     diagnosis: '诊断内容',
                //     consultants: '咨询护士',
                //     doctorName: '开单医生',
                //     followupTime: '2022-09-05 10:29:39',
                //     followupForm: '电话',
                //     followupMoment: '咨询前',
                //     followupPeople: '随访人',
                //     followupRecords: '随访记录',
                // }
            ],
            diagnosisAndProjectDataList: [
                // {
                //     index: 1,
                //     id: 1,
                //     name: '王晓',
                //     programDate: '2022-09-05 10:29:39',
                //     status: 0,
                //     diagnosis: '诊断内容',
                //     consultants: '咨询护士',
                //     doctorName: '开单医生',
                //     treatmentProgram: '治疗方案',
                //     remark: '备注内容',
                // }
            ],
            treatmentRecordDataList: [
                // {
                //     index: 1,
                //     id: 1,
                //     name: '王晓',
                //     registrationDate: '2022-09-05 10:29:39',
                //     diagnosis: '诊断内容',
                //     doctorName: '诊断医生',
                //     fuyao: '敷药',
                //     status: 0,
                //     treatmentProgram: '',
                //     numberOfTreatments: '3/10',
                //     treatmentAge: 24,
                //     treatmentResponse: '',
                //     treatmentResult: '',
                //     treatmentDate: '2022-09-05 10:29:39',
                //     treatmentPrice: '100',
                //     remark: '备注内容',
                // }
            ],
            // 诊前问卷弹出层标题
            questionnaireTitle: "",
            // 知情同意书弹出层是否显示
            consentDialog: false,
            // 诊前问卷表单控件列表
            formpreviewContList: null,
            formInfo: {},
            questionFormInfo: {
                name: '',
                remark: '',
            },
            picData: [],
            srcList: [],
            // 日期范围
            dateRange: [],
            myAnswer: null,//存放表单答案
            activeName: 0,
            zqtysImg: require("@/assets/images/zqtys.jpg"),
            comparePicsDialogVisible: false

        };
    },
    created() {
        this.getAddressData();
        this.getPatientList();
        if (this.currentTab == 'pictures') {
            this.search();
        }
    },
    mounted() {
        console.log(this.$router)

    },
    methods: {
        //获取诊断状态字典值对应的label
        getDiagnosisStatusLabel(status) {
            let label = ''
            this.dict.type.sys_diagnosis_status.forEach((item) => {
                if (item.value == status) {
                    label = item.label
                }
            })
            return label

        },
        // 获取顾客登记列表
        getPatientList() {
            const patientId = this.$route.params && this.$route.params.patientId
            const queryParams = { pageNum: 1, pageSize: 9999, patientId: patientId }
            getVisit(queryParams).then(
                (response) => {
                    this.baseInfoData = response.rows
                    this.baseInfoData.forEach(item => {
                        item.area = [
                            Number(item.provinceId),
                            Number(item.cityId),
                            Number(item.countyId),
                        ];
                    })
                }
            )
        },
        getPicPreviewList(row) {
            this.srcList = []
            row.sysPatientPhotos.forEach((it) => {
                this.srcList.push(this.baseUrl + it.photoAddress)
            })
        },
        handleconsentDialog(row) { this.consentDialog = true },
        /** 诊前问卷按钮操作 */
        async openQuestionnaire(row, index) {
            this.isActive = index
            this.formInfo = row;
            this.myAnswer = JSON.parse(row.answer)
            await this.getFormContList()
            this.questionnaireTitle = row.name
        },
        // 获取地区
        getAddressData() {
            addressJson().then((res) => {
                this.areaList = res.data;
            });
        },
        //查询
        search() {
            this.pictureForm.patientId = this.$route.params && this.$route.params.patientId
            this.getPhotoList()
        },
        //根据病人id获取图片列表
        getPhotoList() {
            listPhoto(this.addDateRange(this.pictureForm, this.dateRange)).then((res) => {
                if (res.data.length > 0) {
                    this.picData = res.data;
                } else {
                    this.picData = [];
                }
            });
        },
        //tab点击切换
        tabHandleClick(tab) {
            if (tab.name === "PrediagnosisQuestionnaire") {
                this.isActive = "1"
                this.getListCustomerForm()
            }
            if (tab.name === "pictures") {
                this.search();
            }
            if (tab.name === "followupVisitDataList") {
                this.getListCustomerForm()
            }
        },
        comparePics() {
            this.comparePicsDialogVisible = true
        },
        /** 查询表单内容控件列表 */
        getFormContList() {
            listFormCont({
                formId: this.formInfo.formId
            }).then((response) => {
                this.questionFormInfo.name = response.name
                this.questionFormInfo.remark = response.remark
                this.formpreviewContList = response.rows;
                this.formpreviewContList.forEach((item, index) => {
                    this.$set(item, 'answer', this.myAnswer[index].answer)
                })
            });
        },
        /** 查询顾客表单列表 */
        getListCustomerForm() {
            let that = this
            const patientId = this.$route.params && this.$route.params.patientId
            listCustomerForm({ patientId: patientId }).then((response) => {
                that.prediagnosisQuestionnaireDataList = response.rows
                that.openQuestionnaire(response.rows[0])
            });
        },

        /** 修改答案 */
        updateFormAnswer() {
            let answerArr = []
            this.formpreviewContList.forEach(item => {
                answerArr.push({
                    answer: item.answer,
                    questionId: item.questionId
                })
            })
            let answerStr = JSON.stringify(answerArr)
            let mData = {
                answerId: this.myAnswerId,
                answer: answerStr,
            }
            updateAnswer(mData).then((response) => {
                this.$message.success('修改成功')
            });
        },
    },
};
</script>
<style>
.date-header {
    line-height: 60px;
    color: red;
}

.treatment-tips {
    text-align: center;
    line-height: 60px;
}

.img-txt {
    display: flex;
    flex-direction: column;
    text-align: center;
    margin: 14px;
}

.el-collapse-item__header {
    font-size: 16px;
    color: #409EFF;
}

.base-info-box {
    margin: 20px 0;
}

.base-info-box span {
    margin-right: 15px;
}

.group-info {
    display: flex;
}

.group-info span {
    margin-right: 15px;
}

.group-info .device div {
    display: inline-block;
    vertical-align: middle;
}

.yesActive {
    background-color: #409EFF;
    color: #fff;
}
</style>
